/*
 * main.c
 * Copyright (c) 2010 Peter Polacik <polacik.p@gmail.com>
 *
 * This file is part of Beix Operating System
 *
 * Licensed under MIT License, see COPYRIGHT for more information.
 */

#include <beix.h>

void *memcpy(void *dest, const void *src, size_t count)
{
	const char *sp = (const char *)src;
	char *dp = (char *)dest;
	for (; count != 0; count--) *dp++ = *sp++;
	return dest;
}

void *memset(void *dest, char val, size_t count)
{
	char *temp = (char *)dest;
	for (; count != 0; count--) *temp++ = val;
	return dest;
}

u16int *memsetw(u16int *dest, u16int val, size_t count)
{
	u16int *temp = (u16int *)dest;
	for (; count != 0; count--) *temp++ = val;
	return dest;
}

size_t strlen(const char *str)
{
	size_t retval;
	for (retval = 0; *str != '\0'; str++) retval++;
	return retval;
}

u8int inportb(u16int _port)
{
	u8int rv;
	__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
	return rv;
}

void outportb(u16int _port, u8int _data)
{
	__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}

int main(void)
{
	gdt_install();
	init_video();
	settextcolor(LGREY, BLACK);
	puts("Skuska pisania vsetkeho, dokonca aj \n mozno aj a\b\b\b\rlol\n\tskuska.\n");
	for (;;);
}
